﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

<!--back-->
<div class="w_980">
	<!--back_box-->
	<div class="back_box clearfix">
    	<!--left-->
    	        <% 
            Html.RenderPartial("~/Views/Shared/VipCenterList.ascx");
        %>
    	<!--right-->
        <div class="back_main">
        	<h3>历史订单</h3>
            <% 
                BIZ.LibraryBookIndentOper bio = new BIZ.LibraryBookIndentOper();
                int pageno = Request["pageno"] == null ? 1 : int.Parse(Request["pageno"].ToString());//当前页
                int pagesize = 15;//单页记录数
                int count = 0;//总记录数
                int pageNumber = 0;//总页数       
                IList li = bio.userGetHistroyList(pageno, pagesize, ((DomainModel.UserInfo)Session["user"]).u_id);
            %>
            <div class="old_order_box">
                <!--table_box-->
                <div class="table_box">
                	<table>                                                                                
                    	<thead>
                        	<tr>
                            	<th width="270">书名</th>
                            	<th width="140" class="txt_left" style="padding-left:10px;">作者</th>
                            	<th width="150" class="txt_left" style="padding-left:10px;">下单时间</th>
                            	<th>订单状态</th>
                            </tr>
                        </thead>
                        <tbody>
                        	 <% 
                                 foreach (Hashtable tb in li)
                                 {
                                     if (tb["total"] == null)
                                     {
                             %>
                                                         <tr>
                            	<td><a href="/Search/detail.html?id=<%=tb["lb_id"] %>" class="book_title_color"><%=tb["lb_bookName"]%></a></td>
                            	<td><%=tb["lb_author"]%></td>
                            	<td><%=tb["lbi_time"]%></td>
                            	<td class="txt_center"><%=Enum.GetName(typeof(DAL.Enums.bookstate), int.Parse(tb["lbi_state"].ToString()))%></td>
                            </tr>
                             <%

                                     }
                                     else
                                         count = (tb["total"] == null ? 0 : int.Parse(tb["total"].ToString()));
                                 } 
                             %>
                        </tbody>
                    </table>
                </div>
            	<!--bottom_bar-->
            </div>
                    <!--pager-->
        <div class="pager">
        <%
            pageNumber = ((count % pagesize) == 0 ? (count / pagesize) : ((count / pagesize) + 1));
            int start = pagesize * (pageno - 1) + 1;
            if (start < 0)
                start = 0;
            int end = (start + pagesize-1);
            if (pageno == pageNumber)
            {
                if ((count % pagesize) != 0)
                {
                    end = (start + (count % pagesize) - 1);
                }
            }
        %>
            <p class="left"><%=count%> 条记录，显示第 <%=start %> 条 - 第 <%=end %> 条记录</p>
            <p class="right"><a href="/vipcenter/histroylist.html?f=e1&pageno=1" title="首页" class="a1 a1_n"></a>
            <a href="/vipcenter/histroylist.html?f=e1&pageno=<%=(pageno==1?1:pageno-1) %>" title="上一页" class="a2"></a><span>第<b><%=pageno %></b>页/共 <%=pageNumber %> 页</span>
            <a href="/vipcenter/histroylist.html?f=e1&pageno=<%=(pageno==pageNumber?pageNumber:pageno+1) %>" title="下一页" class="a3"></a><a href="/vipcenter/histroylist.html?f=e1&pageno=<%=pageNumber %>" title="末页" class="a4"></a>
            <select id="sPage">
            <% 
                for (int k = 1; k <= pageNumber;k++ )
                    Response.Write("<option value=\"" + k.ToString() + "\">" + k.ToString() + "</option>");
            %>
            </select></p>
            <script type="text/javascript" language="javascript">
                $(function () {
                    $("#sPage").val(<%=pageno %>);
                    $("#sPage").change(function () {
                        window.location.href = "/vipcenter/histroylist.html?f=e1&pageno=" + $("#sPage").val();
                    });
                })
            </script>
        </div>
        </div>
    </div>
</div>


</asp:Content>
